<template>
  <div>
    <Card>
      <div slot="title">
        <div class="edit-head">
          <a @click="goBack" class="back-title">
            <Icon type="ios-arrow-back" />返回
          </a>
        </div>
      </div>
      <div>
        <!-- 货主信息 -->
        <div>
          <!-- <div
            style="padding-bottom: 10px"
            v-if="this.detailsGoods.status == '1'"
          >
            失败原因：
            <span class="ReasonsFailureAudit">
              {{ this.detailsGoods.refuseReason }}</span
            >
          </div> -->
          <div
            style="display: flex; justify-content: space-between; height: 80px"
          >
            <div class="Ownerdw">
              <div class="Ownerdw-shipper">
                <span></span>
              </div>
              <div class="Ownerpoit">
                <img
                  v-show="this.cargoAvatar != ''"
                  :src="this.cargoAvatar"
                  alt=""
                  srcset=""
                />
              </div>
              <div class="OwnerName">
                <div>
                  <span>{{
                    this.detailsGoods.cargoOwnerInfoVo.personalName
                  }}</span>
                  <span class="OwnerName1">{{
                    this.detailsGoods.cargoOwnerInfoVo.mobile
                  }}</span>
                </div>

                <div class="Owner-company">
                  <span
                    v-if="this.detailsGoods.cargoOwnerInfoVo.companyName != ''"
                  >
                    {{ this.detailsGoods.cargoOwnerInfoVo.companyName }}
                  </span>
                  <span
                    style="color: #a9a9a9"
                    v-if="
                      this.detailsGoods.cargoOwnerInfoVo.companyName == '' ||
                      this.detailsGoods.cargoOwnerInfoVo.companyName == null
                    "
                  >
                    未进行企业认证</span
                  >
                </div>
              </div>
            </div>
            <div class="Ownertiem">
              <div>
                <!-- 待审核 审核失败  待执行 报价中 已关闭 已完结-->
                <span
                  :class="
                    this.detailsGoods.status == '0'
                      ? 'implemented'
                      : this.detailsGoods.status == '1'
                      ? 'AuditFailed'
                      : this.detailsGoods.status == '2'
                      ? 'deeltes'
                      : this.detailsGoods.status == '3'
                      ? 'quotation'
                      : this.detailsGoods.status == '4'
                      ? 'deeltes'
                      : this.detailsGoods.status == '5'
                      ? 'deeltes'
                      : this.detailsGoods.status == '6'
                      ? 'erreCss'
                      : this.detailsGoods.status == '-1'
                      ? 'deeltes'
                      : 'statee'
                  "
                >
                  {{
                    this.$options.filters["SOURCE_STATUS"](
                      this.detailsGoods.status
                    )
                  }}
                </span>
              </div>

              <div style="color: #999999; margin-left: 25px">
                {{ this.detailsGoods.createTime }}
              </div>
            </div>
          </div>
        </div>
        <!-- 货物信息 -->
        <div class="Line"></div>
        <div>
          <el-descriptions
            class="margin-top SourcIormation"
            title="货源信息"
            :column="4"
            size="medium"
            border
          >
            <template slot="extra">
              <Row class="operation"> </Row>
            </template>
            <!-- 地址 -->
            <el-descriptions-item>
              <template slot="label"> 装货地址： </template>
              {{ this.beginAreaCodeShow }}
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label"> 详细地址 ： </template>
              {{ this.detailsGoods.beginAddress }}
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label"> 装运范围： </template>
              {{ this.detailsGoods.pretendEnclosure }} km
            </el-descriptions-item>

            <el-descriptions-item>
              <template slot="label"> 发货单位： </template>
              <span
                class="NotFilled"
                v-if="
                  this.detailsGoods.extractName == '' ||
                  this.detailsGoods.extractName == null
                "
              >
                未填写
              </span>
              <span v-else>
                <span>{{ this.detailsGoods.extractName }}</span
                >/ <span>{{ this.detailsGoods.extracContactName }}</span
                >/
                <span>{{ this.detailsGoods.extractPhone }}</span>
              </span>
            </el-descriptions-item>

            <el-descriptions-item>
              <template slot="label"> 卸货地址： </template>
              {{ this.endAreaCodeShow }}
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label"> 详细地址： </template>
              {{ this.detailsGoods.endAddress }}
            </el-descriptions-item>
            <el-descriptions-item
              label-class-name="my-label"
              content-class-name="my-content"
            >
              <template slot="label"> 签收范围： </template>
              {{ this.detailsGoods.dischargeEnclosure }} km
            </el-descriptions-item>

            <el-descriptions-item>
              <template slot="label">收货单位： </template>
              <span
                class="NotFilled"
                v-if="
                  this.detailsGoods.takeName == '' ||
                  this.detailsGoods.takeName == null
                "
              >
                未填写
              </span>
              <span v-else>
                <span> {{ this.detailsGoods.takeName }}</span
                >/ <span> {{ this.detailsGoods.takeContactName }}</span
                >/
                <span> {{ this.detailsGoods.takePhone }}</span>
              </span>
            </el-descriptions-item>
          </el-descriptions>
          <!-- 装运时效 -->
          <div style="margin: 20px 0"></div>

          <!-- 计价方式 -->
          <div style="margin: 20px 0"></div>
          <el-descriptions class="margin-top" :column="4" size="medium" border>
            <el-descriptions-item>
              <template slot="label"> 货源编号： </template>
              {{ this.detailsGoods.goodNo }}
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label"> 货品名称： </template>
              {{ this.detailsGoods.goodSubType }}
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label"> 货物类型： </template>
              {{ this.detailsGoods.goodType | TypeGoods }}
            </el-descriptions-item>

            <el-descriptions-item>
              <template slot="label"> 运费单价： </template>
              <span style="color: #dc143c">{{
                this.detailsGoods.freightUnitPrice != "" &&
                this.detailsGoods.freightUnitPrice != null
                  ? this.detailsGoods.freightUnitPrice
                  : "0"
              }}</span>
              元/吨
            </el-descriptions-item>

            <el-descriptions-item>
              <template slot="label">计价方式： </template>
              <span
                class="NotFilled"
                v-if="this.detailsGoods.valuationUnit == null"
              >
                未填写
              </span>
              <span v-else>
                {{
                  this.detailsGoods.valuationUnit == "1"
                    ? "按重量"
                    : this.detailsGoods.valuationUnit == "2"
                    ? "按体积"
                    : "按件数"
                }}</span
              >
            </el-descriptions-item>

            <el-descriptions-item>
              <template slot="label">发布数量： </template>
              <span>{{ this.detailsGoods.totalGoodWeight }}</span>
              吨
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label">剩余数量： </template>
              <span style="color: #dc143c">{{
                this.detailsGoods.goodWeight
              }}</span>
              吨
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label"> 体积： </template>
              {{
                this.detailsGoods.volume == null
                  ? "0"
                  : this.detailsGoods.volume
              }}
              m³
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label"> 件数： </template>
              {{
                this.detailsGoods.piece == null ? "0" : this.detailsGoods.piece
              }}
              件
            </el-descriptions-item>

            <el-descriptions-item>
              <template slot="label" content-class-name="LengthContent"
                >运输要求：
              </template>
              <span
                class="NotFilled"
                v-if="subRemarks == '' || subRemarks == null"
              >
                未填写
              </span>
              <span v-else>
                <Tooltip max-width="200" :content="this.detailsGoods.content">
                  {{ subRemarks }}
                </Tooltip>
              </span>
            </el-descriptions-item>
          </el-descriptions>
          <!--  -->
          <el-descriptions
            class="margin-top SourcIormation"
            title=""
            size="medium"
            border
          >
            <template slot="extra">
              <Row class="operation"> </Row>
            </template>
            <!-- 地址 -->
            <el-descriptions-item>
              <template slot="label"> 运输时效： </template>
              <span> {{ this.detailsGoods.prescription }}</span> 小时
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label"> 装车时间： </template>
              <div v-if="detailsGoods.loadingTimeList.length > 0">
                <span
                  v-for="(item, index) in detailsGoods.loadingTimeList"
                  :key="index"
                >
                  <span class="time-css-box">{{ item }}</span
                  >,&nbsp;
                </span>
              </div>
              <div v-else>
                <span>---</span>
              </div>
            </el-descriptions-item>
          </el-descriptions>

          <!-- 定价方式 -->
          <div style="margin: 20px 0"></div>
          <el-descriptions class="margin-top" :column="4" size="medium" border>
          </el-descriptions>
        </div>
        <!-- 报价表格 -->
        <div style="margin: 10px 0"></div>
        <div
          v-if="
            this.detailsGoods.business == '1' &&
            (this.detailsGoods.status == 3 ||
              this.detailsGoods.status == 4 ||
              this.detailsGoods.status == 5)
          "
        >
          <div class="butTable">
            <div class="butTableoffer">
              抢单列表
              <span
                style="margin-left: 10px"
                v-if="
                  this.detailsGoods.business == '1' &&
                  (this.detailsGoods.status == 3 ||
                    this.detailsGoods.status == 4 ||
                    this.detailsGoods.status == 5)
                "
              >
                <span v-if="this.detailsGoods.pricingMethod == '2'"
                  >(委托最高价 ：{{ this.detailsGoods.driverMaximum }}
                  {{ this.detailsGoods.pricingType == "1" ? "元/吨" : "元" }}
                  | 结算方式 ：{{
                    this.detailsGoods.driverPayType | PAYMENT
                  }})</span
                >
                <span
                  v-if="
                    this.detailsGoods.pricingMethod == '1' &&
                    this.detailsGoods.pricingType == '1'
                  "
                  >( 委托单价：{{ this.detailsGoods.driverUnitPrice }} 元/吨 |
                  结算方式：{{ this.detailsGoods.driverPayType | PAYMENT }}
                  )
                </span>
                <span
                  v-if="
                    this.detailsGoods.pricingMethod == '1' &&
                    this.detailsGoods.pricingType == '2'
                  "
                  >( 委托总价：{{ this.detailsGoods.driverTotalPrice }} 元 |
                  结算方式：{{ this.detailsGoods.driverPayType | PAYMENT }}
                  )
                </span>
              </span>
              <span
                v-if="
                  this.detailsGoods.status == '3' &&
                  this.detailsGoods.exhibition == '3'
                "
                @click="ReleaseScopeClick"
                style="
                  margin-left: 10px;
                  cursor: pointer;
                  width: 120px;
                  height: 50px;
                  padding: 5px;
                  color: #f90;
                  padding-top: 10px;
                  font-weight: 800;
                  font-size: 14px;
                "
              >
                查看发布范围 &nbsp; >
              </span>
            </div>
            <div style="display: flex">
              <div style="margin-right: 10px">
                <Select
                  clearable
                  v-model="stateScreen"
                  style="width: 115px"
                  placeholder="报价状态"
                  @on-change="companyChange"
                >
                  <Option
                    v-for="(item, index) in stateScreenArray"
                    :key="index"
                    :value="item.value"
                    >{{ item.label }}</Option
                  >
                </Select>
              </div>
              <div>
                <Button @click="UnitPriceorting"
                  >单价排序
                  <Icon
                    :type="
                      this.UnitPriceIcon == true
                        ? 'ios-arrow-up'
                        : 'ios-arrow-down'
                    "
                  />
                </Button>
              </div>
            </div>
          </div>
          <Row>
            <Table
              :loading="loading"
              border
              :columns="driverColumns"
              :data="getQuotationRecordData"
              ref="table"
              class="table"
            ></Table>
          </Row>

          <Row type="flex" justify="end" class="page">
            <Page
              :current="searchForm.pageNumber"
              :total="total"
              :page-size="searchForm.pageSize"
              @on-change="changePage"
              @on-page-size-change="changePageSize"
              :page-size-opts="[1, 5, 10]"
              size="small"
              show-total
              show-elevator
              show-sizer
            ></Page>
          </Row>
        </div>
      </div>
      <div style="margin: 10px 0"></div>
    </Card>
    <div class="Cardokbtn">
      <div class="okbtn">
        <div class="butall">
          <div style="margin-left: 30px">
            <!-- -1 '已删除'  0 '待审核'   1 '已拒绝' 3 '进行中' 4 '已关闭'5 '已完结' -->
            <Button
              type="primary"
              @click="SourceApproved"
              v-if="this.detailsGoods.status == '0'"
              >审核通过</Button
            >
            <span v-if="this.detailsGoods.status == '0'">
              &nbsp;
              <Button @click="AuditFailed" type="error">审核不通过</Button>
            </span>
            <span v-if="this.detailsGoods.status == '3'">
              &nbsp; &nbsp; &nbsp; &nbsp;
              <Button
                type="warning"
                :loading="loadingbut"
                @click="dispatchingDriver"
                >调度派单</Button
              >
            </span>
            <span v-if="this.detailsGoods.status == '3'">
              &nbsp;
              <Button @click="closeSourceOfGoods" type="error">关闭货源</Button>
            </span>
            <span v-if="this.detailsGoods.status == '4'">
              &nbsp;
              <Button @click="OpenSource" type="primary">开启货源</Button>
            </span>
            <span
              v-if="
                this.detailsGoods.status == '3' ||
                this.detailsGoods.status == '4'
              "
            >
              &nbsp;

              <Button @click="CloseSource" type="error"> 完结货源</Button>
            </span>
            <span
              v-if="
                this.detailsGoods.status == '5' ||
                this.detailsGoods.status == '-1'
              "
            >
              &nbsp;
              <Button @click="OneMoreOrder" type="primary">再来一单</Button>
            </span>
            <span
              v-if="
                this.detailsGoods.status == '1' ||
                this.detailsGoods.status == '3' ||
                this.detailsGoods.status == '4'
              "
            >
              &nbsp;
              <Button type="primary" @click="OwnerModification"
                >修改货源</Button
              >
            </span>
            <span v-if="this.detailsGoods.status == '5'">
              &nbsp;
              <Button @click="deleteOwner" type="error">删除货源</Button>
            </span>
          </div>
          <div
            style="padding-bottom: 10px; padding-right: 30px"
            v-if="this.detailsGoods.status == '1'"
          >
            失败原因：
            <span class="ReasonsFailureAudit">
              {{ this.detailsGoods.refuseReason }}</span
            >
          </div>
        </div>
      </div>
    </div>
    <!-- 信息弹框 -->
    <!-- <OwnerDetails> </OwnerDetails> -->
    <!-- 审核不审核通过 -->
    <Modal v-model="AuditFailedModal" title="审核不通过">
      <Input
        v-model="AuditFailedInput"
        type="textarea"
        :rows="4"
        placeholder="请输入审核不通过原因"
      />
      <div slot="footer">
        <Button
          :loading="loadingbut"
          type="primary"
          @click="AuditRejectDetermine"
          >确定</Button
        >
      </div>
    </Modal>
    <!-- 驾驶员详情   -->
    <DriverDetails
      @DriverDetaEnd="DriverDetaEnd"
      :BidderdUserId="BidderdUserId"
      :driverModalue="this.driverModalue"
    >
    </DriverDetails>
    <!-- 货主详情 -->
    <OwnerDetails
      @OwnerDetaiEnd="OwnerDetaiEnd"
      :OwnerDetailsId="OwnerDetailsId"
      :OwnerDetailsModalue="this.OwnerDetailsModalue"
    >
    </OwnerDetails>
    <!-- 车辆详情 -->
    <VehicleDetails
      @VehicleDetailsEnd="VehicleDetailsEnd"
      :VehicleDetailsId="VehicleDetailsId"
      :VehicleDetailsModalue="this.VehicleDetailsModalue"
    >
    </VehicleDetails>
    <!-- 向上报价 -->
    <Modal
      v-model="upwardQuotationModal"
      :title="upwardQuotationTitle"
      width="600"
    >
      <Form
        :label-width="120"
        ref="upwardQuotationForm"
        :model="upwardQuotationForm"
        :rules="upwardQuotationRuleIn"
        inline
      >
        <FormItem label="承运重量" prop="transGoodWeight">
          <InputNumber
            :min="0"
            style="width: 220px"
            v-model="upwardQuotationForm.transGoodWeight"
            placeholder="请输入承运重量"
            @on-change="GoodWeightFocus"
          >
          </InputNumber>
        </FormItem>
        <FormItem label="运费单价" prop="freightUnitPrice">
          <div>
            <InputNumber
              :min="0"
              :editable="freightUnitPriceStatus"
              style="width: 220px"
              v-model="upwardQuotationForm.freightUnitPrice"
              placeholder="请输入运费单价"
              @click.native="freightUnitFocus"
              @on-change="UnitPriceChange"
            >
            </InputNumber>
            <span class="InputNuspanfont"> 元/吨</span>
          </div>
        </FormItem>

        <FormItem label="运费总价" prop="freightTotalPrice">
          <div>
            <InputNumber
              :min="0"
              :editable="freightTotalPriceStatus"
              style="width: 220px"
              v-model="upwardQuotationForm.freightTotalPrice"
              placeholder="请输入运费总价"
              @click.native="freightTotFocus"
              @on-change="TotalPriceChange"
            >
            </InputNumber>
            <span class="InputNuspanfont">元</span>
          </div>
        </FormItem>

        <FormItem label="体积">
          <div>
            <InputNumber
              :min="0"
              style="width: 220px"
              v-model="upwardQuotationForm.volume"
              placeholder="输入货品体积"
            >
            </InputNumber>
            <span class="InputNuspan">m³</span>
          </div>
        </FormItem>
        <FormItem label="件数">
          <div>
            <InputNumber
              :min="0"
              style="width: 220px"
              v-model="upwardQuotationForm.piece"
              placeholder="输入货品件数"
            >
            </InputNumber>
            <span class="InputNuspan">件</span>
          </div>
        </FormItem>
        <FormItem label="备注">
          <Input
            type="textarea"
            style="width: 400px"
            v-model="upwardQuotationForm.remarks"
            placeholder="请输入备注"
          >
          </Input>
        </FormItem>
      </Form>
      <div slot="footer">
        <Button @click="upwardQuotationModal = false">取消</Button>
        <Button
          :loading="loadingbut"
          type="primary"
          @click="upwardQuotationDetermine"
          >确定</Button
        >
      </div>
    </Modal>
    <!-- 发布范围 转发是选择公开发布不显示-->
    <Modal v-model="ReleaseScopeModal" title="发布范围" width="710">
      <div style="overflow: auto; height: 300px">
        <div
          v-for="(item, index) in this.detailsGoods.exhibitionDriver"
          :key="index"
        >
          <!-- closable -->
          <div class="TagModal">
            <Tag @on-close="DeleteDriver" size="large"
              >{{ item.driverName }} {{ item.vehicleNum }}</Tag
            >
          </div>
        </div>
      </div>
    </Modal>
    <!--  -->

    <Modal v-model="sourceEntrustment" title="货源委托">
      <div style="text-align: right; margin-left: 20px">
        <List :border="false" :split="false" header="" footer="" size="small">
          <div style="text-align: right">
            <ListItem>
              <span>货源编号：</span>
              <span class="listMomoney">{{ detailsGoods.goodNo }}</span>
            </ListItem>
            <ListItem>
              <span>发布数量：</span>
              <span class="listMomoney"
                >{{ detailsGoods.totalGoodWeight }} 吨</span
              >
            </ListItem>
            <ListItem>
              <span style="margin-left: -13px"
                >　{{
                  this.detailsGoods.pricingMethod == "1" &&
                  this.detailsGoods.pricingType == "1"
                    ? "运费单价："
                    : "运费总价："
                }}　</span
              >
              <span style="font-weight: 600">
                <span
                  v-if="
                    this.detailsGoods.pricingMethod == '1' &&
                    this.detailsGoods.pricingType == '1'
                  "
                >
                  <span style="color: #dc143c">{{
                    this.detailsGoods.freightUnitPrice != "" &&
                    this.detailsGoods.freightUnitPrice != null
                      ? this.detailsGoods.freightUnitPrice
                      : "0"
                  }}</span>
                  元/吨
                </span>
                <span
                  v-if="
                    this.detailsGoods.pricingMethod == '1' &&
                    this.detailsGoods.pricingType == '2'
                  "
                >
                  {{
                    this.detailsGoods.estimateAmt != "" &&
                    this.detailsGoods.estimateAmt != null
                      ? this.detailsGoods.estimateAmt
                      : "0"
                  }}
                  元
                </span>
              </span>
            </ListItem>

            <ListItem>
              <span>抢单编号：</span>
              <span class="listMomoney">{{ companyData.quotationNo }} </span>
            </ListItem>

            <ListItem>
              <span>抢单时间：</span>
              <span class="listMomoney">{{ companyData.createTime }} </span>
            </ListItem>

            <ListItem>
              <span style="margin-left: 14px">抢单人：</span>
              <span class="listMomoney">{{ companyData.driverName }} </span>
            </ListItem>

            <ListItem>
              <span>当前报价：</span>

              <span class="listMomoney">
                <span style="color: #dc143c">
                  {{ companyData.driverUnitPrice }}
                </span>
                元/吨
              </span>

              <span class="listMomoney">
                <span style="color: #dc143c">
                  {{ companyData.driverTotalPrice }}
                </span>
                元
              </span>
            </ListItem>
            <ListItem>
              <span>拟承运量：</span>
              <span class="listMomoney"
                >{{ companyData.transGoodWeight }} 吨</span
              >
            </ListItem>
          </div>
        </List>
      </div>

      <div slot="footer">
        <Button @click="sourceEntrustment = false">取消</Button>
        <Button :loading="loadingbut" type="primary" @click="EntrustedDriver"
          >确定</Button
        >
      </div>
    </Modal>
  </div>
</template>

<script>
import {
  getGoodsDetails,
  toExamineGoods,
  updateGoodsStatus,
  delGoods,
  platformQuotationRecord,
  addQuotationRecord,
  entrustDriver,
  goodsInvoicingEtc,
} from "@/api/index";
import { getStore, setStore } from "@/libs/storage";
import DriverDetails from "@/views/componentsonn_source_goods/DriverDetails";
import OwnerDetails from "@/views/componentsonn_source_goods/OwnerDetails";
import VehicleDetails from "@/views/componentsonn_source_goods/VehicleDetails";
import defaultAvatar from "@/assets/customer.png";
export default {
  data() {
    return {
      openDate: "", //开始
      endDate: "", //结束
      startReceivingTime: "", //开始
      endReceivingTime: "", //结束

      sourceEntrustment: false,
      companyData: {},

      allocationRadio: "派单",
      etc: "不开票",
      sourceAudit: false,
      degreeUrgency: "1",
      billMnagement: "",
      defaultAvatar: defaultAvatar, //默认头像

      ReleaseScopeModal: false,
      subRemarks: "", //备注展示
      getQuotationRecordData: [], //报价单数据

      BidderdUserId: "", //报价人Id
      driverModalue: false, //驾驶员详情弹框

      OwnerDetailsId: "", //货主Id
      OwnerDetailsModalue: false, //货主详情弹框

      VehicleDetailsId: "", //车辆id
      VehicleDetailsModalue: false, //车辆详情弹框

      loadingclose: false,
      loadingClose: false,
      header: {
        accessToken: getStore("accessToken"),
      },
      accessToken: getStore("accessToken"),
      cargoAvatar: "", //头像
      carrierAvatar: "",
      loadingbut: false, //按钮的加载效果
      AuditFailedModal: false, //审核不审核通过的弹框
      AuditFailedInput: "", //审核不审核通过的原因
      OwnerInformationModal: false, //货主详细信息弹框
      UnitPriceIcon: false, //单价图标
      offerIcon: true, //报价图标
      beginAreaCodeShow: "", //起始县区列表 回显code
      endAreaCodeShow: "", //结束县区列表 回显code
      detailsGoods: {
        cargoOwnerInfoVo: {},
        platformInfoVo: {},
        loadingTimeList: [],
      },
      stateScreenArray: [
        { value: "", label: "全部" },
        { value: "0", label: "待报价" },
        { value: "1", label: "已报价" },
        { value: "2", label: "待委托" },
        { value: "3", label: "已委托" },
      ],
      // 向上报价
      upwardQuotationModal: false, //向上报价弹框
      freightUnitPriceStatus: false,
      freightTotalPriceStatus: false,
      upwardQuotationForm: {
        quotationRecordId: "",
        goodsId: "",
        freightUnitPrice: "",
        freightTotalPrice: "",
        transGoodWeight: "",
        volume: "",
        piece: "",
        remarks: "",
      },
      upwardQuotationRuleIn: {
        freightUnitPrice: [
          {
            type: "number",
            required: true,
            message: "请输入运费单价",
            trigger: "blur",
          },
        ],
        freightTotalPrice: [
          {
            type: "number",
            required: true,
            message: "请输入运费总价",
            trigger: "blur",
          },
        ],
        transGoodWeight: [
          {
            type: "number",
            required: true,
            message: "请输入承运重量",
            trigger: "blur",
          },
        ],
      },
      companyColumns: [
        {
          title: "抢单编号",
          key: "quotationNo",
          minWidth: 190,
          sortable: false,
        },
        {
          title: "抢单时间",
          key: "createTime",
          minWidth: 175,
          sortable: false,
        },
        {
          title: "抢单人",
          key: "driverName",
          minWidth: 220,
          sortable: false,
          render: (h, params) => {
            {
              return h("div", [
                h(
                  "a",
                  {
                    on: {
                      click: () => {
                        this.LookCargoOwnerInfo1(params.row);
                      },
                    },
                  },
                  params.row.driverName
                ),
              ]);
            }
          },
        },
        {
          title: "当前报价",
          key: "",
          minWidth: 195,
          render: (h, params) => {
            return h("div", [
              h("span", "￥" + params.row.driverUnitPrice),
              h("Divider", {
                props: {
                  type: "vertical",
                },
              }),
              h("span", "￥" + params.row.driverTotalPrice),
            ]);
          },
        },
        {
          title: "向上报价",
          key: "",
          minWidth: 195,
          render: (h, params) => {
            if (params.row.platformTotalPrice == null) {
              return h("div", "未报价");
            } else {
              return h("div", [
                h("span", "￥" + params.row.platformUnitPrice),
                h("Divider", {
                  props: {
                    type: "vertical",
                  },
                }),
                h("span", "￥" + params.row.platformTotalPrice),
              ]);
            }
          },
        },
        {
          title: "拟承运量",
          key: "transGoodWeight",
          minWidth: 200,
          render: (h, params) => {
            let volume = 0;
            let piece = 0;
            if (params.row.volume == null) {
              volume = 0;
            } else {
              volume = params.row.volume;
            }

            if (params.row.piece == null) {
              piece = 0;
            } else {
              piece = params.row.piece;
            }
            return h("div", [
              h("span", params.row.transGoodWeight + "吨"),
              h("Divider", {
                props: {
                  type: "vertical",
                },
              }),
              h("span", volume + " m³"),
              h("Divider", {
                props: {
                  type: "vertical",
                },
              }),
              h("span", piece + " 件"),
            ]);
          },
        },
        {
          title: "备注",
          key: "remarks",
          minWidth: 120,
          tooltip: true,
        },
        {
          title: "变更记录",
          key: "number",
          minWidth: 100,
          render: (h, params) => {
            let text = params.row.number;
            let numlist;
            let placTop = "top";
            if (params.index == 0) {
              placTop = "bottom";
            } else {
              placTop = "top";
            }
            return h(
              "Tooltip",
              {
                props: { placement: "top", maxWidth: "280", transfer: true },
              },
              [
                h("div", {}, text),
                h(
                  "span",
                  {
                    slot: "content",
                  },
                  params.row.details.map((item) => {
                    return <p>{item}</p>;
                  })
                ),
              ]
            );
          },
        },
        {
          title: "操作",
          key: "",
          minWidth: 110,
          sortable: false,
          render: (h, params) => {
            if (params.row.platformState == "0") {
              return h("div", [
                h(
                  "a",
                  {
                    on: {
                      click: () => {
                        if (
                          this.detailsGoods.status == 3 ||
                          this.detailsGoods.status == 4 ||
                          this.detailsGoods.status == 5
                        ) {
                          this.companyData = params.row;
                          this.sourceEntrustment = true;
                          // this.EntrustedDriver(params.row);
                        } else {
                          this.$Message.warning("当前状态不可操作");
                        }
                      },
                    },
                    style: {
                      color: "#5892EB",
                    },
                  },
                  "委托"
                ),
              ]);
              // return h("div", [
              //   h(
              //     "a",
              //     {
              //       on: {
              //         click: () => {
              //           if (
              //             this.detailsGoods.status == 3 ||
              //             this.detailsGoods.status == 4
              //           ) {
              //             this.upwardQuotationClick(params.row);
              //           } else {
              //             this.$Message.warning("当前状态不可操作");
              //           }
              //         },
              //       },
              //       style: {
              //         color: "#FF8C00",
              //       },
              //     },
              //     "向上报价"
              //   ),
              // ]);
            } else if (params.row.platformState == "1") {
              return h("div", [
                h(
                  "a",
                  {
                    on: {
                      click: () => {
                        if (
                          this.detailsGoods.status == 3 ||
                          this.detailsGoods.status == 4
                        ) {
                          this.editupwardQuotation(params.row);
                        } else {
                          this.$Message.warning("当前状态不可操作");
                        }
                      },
                    },
                    style: {
                      color: "#FF0000",
                    },
                  },
                  "修改"
                ),
              ]);
            } else if (params.row.platformState == "2") {
              return h("div", [
                h(
                  "a",
                  {
                    on: {
                      click: () => {
                        if (
                          this.detailsGoods.status == 3 ||
                          this.detailsGoods.status == 4 ||
                          this.detailsGoods.status == 5
                        ) {
                          this.companyData = params.row;
                          this.sourceEntrustment = true;
                          // this.EntrustedDriver(params.row);
                        } else {
                          this.$Message.warning("当前状态不可操作");
                        }
                      },
                    },
                    style: {
                      color: "#5892EB",
                    },
                  },
                  "委托"
                ),
              ]);
            } else if (params.row.platformState == "3") {
              return h("div", [
                h(
                  "a",
                  {
                    on: {
                      click: () => {
                        //查看运单详情
                      },
                    },
                    style: {
                      color: "#666666",
                    },
                  },
                  "已委托"
                ),
              ]);
            }
          },
        },
      ],
      driverColumns: [
        {
          title: "抢单编号",
          key: "quotationNo",
          minWidth: 190,
          sortable: false,
        },
        {
          title: "抢单时间",
          key: "createTime",
          minWidth: 175,
          sortable: false,
        },
        {
          title: "抢单人",
          key: "driverName",
          minWidth: 120,
          sortable: false,
          render: (h, params) => {
            {
              return h("div", [
                h(
                  "a",
                  {
                    on: {
                      click: () => {
                        this.BidderdDiver(params.row);
                      },
                    },
                  },
                  params.row.driverName
                ),
              ]);
            }
          },
        },
        {
          title: "车辆",
          key: "vehicleNum",
          minWidth: 120,
          render: (h, params) => {
            {
              return h("div", [
                h(
                  "a",
                  {
                    on: {
                      click: () => {
                        this.LookVehicleInfo(params.row);
                      },
                    },
                  },
                  params.row.vehicleNum
                ),
              ]);
            }
          },
        },
        {
          title: "当前报价",
          key: "",
          minWidth: 195,
          render: (h, params) => {
            return h("div", [
              h("span", "￥" + params.row.driverUnitPrice),
              h("Divider", {
                props: {
                  type: "vertical",
                },
              }),
              h("span", "￥" + params.row.driverTotalPrice),
            ]);
          },
        },
        {
          title: "向上报价",
          key: "",
          minWidth: 195,
          render: (h, params) => {
            if (params.row.platformTotalPrice == null) {
              return h("div", "未报价");
            } else {
              return h("div", [
                h("span", "￥" + params.row.platformUnitPrice),
                h("Divider", {
                  props: {
                    type: "vertical",
                  },
                }),
                h("span", "￥" + params.row.platformTotalPrice),
              ]);
            }
          },
        },
        {
          title: "拟承运量",
          key: "transGoodWeight",
          minWidth: 200,
          render: (h, params) => {
            let volume = 0;
            let piece = 0;
            if (params.row.volume == null) {
              volume = 0;
            } else {
              volume = params.row.volume;
            }

            if (params.row.piece == null) {
              piece = 0;
            } else {
              piece = params.row.piece;
            }
            return h("div", [
              h("span", params.row.transGoodWeight + "吨"),
              h("Divider", {
                props: {
                  type: "vertical",
                },
              }),
              h("span", volume + " m³"),
              h("Divider", {
                props: {
                  type: "vertical",
                },
              }),
              h("span", piece + " 件"),
            ]);
          },
        },
        {
          title: "备注",
          key: "remarks",
          minWidth: 120,
          tooltip: true,
        },
        {
          title: "变更记录",
          key: "number",
          minWidth: 100,
          render: (h, params) => {
            let text = params.row.number;
            let numlist;
            let placTop = "top";
            if (params.index == 0) {
              placTop = "bottom";
            } else {
              placTop = "top";
            }
            return h(
              "Tooltip",
              {
                props: { placement: "top", maxWidth: "280", transfer: true },
              },
              [
                h("div", {}, text),
                h(
                  "span",
                  {
                    slot: "content",
                  },
                  params.row.details.map((item) => {
                    return <p>{item}</p>;
                  })
                ),
              ]
            );
          },
        },
        {
          title: "操作",
          key: "",
          minWidth: 110,
          sortable: false,
          render: (h, params) => {
            if (params.row.platformState == "0") {
              return h("div", [
                h(
                  "a",
                  {
                    on: {
                      click: () => {
                        if (
                          this.detailsGoods.status == 3 ||
                          this.detailsGoods.status == 4 ||
                          this.detailsGoods.status == 5
                        ) {
                          this.companyData = params.row;
                          this.sourceEntrustment = true;
                          // this.EntrustedDriver(params.row);
                        } else {
                          this.$Message.warning("当前状态不可操作");
                        }
                      },
                    },
                    style: {
                      color: "#5892EB",
                    },
                  },
                  "委托"
                ),
              ]);
              // return h("div", [
              //   h(
              //     "a",
              //     {
              //       on: {
              //         click: () => {
              //           if (
              //             this.detailsGoods.status == 3 ||
              //             this.detailsGoods.status == 4
              //           ) {
              //             this.upwardQuotationClick(params.row);
              //           } else {
              //             this.$Message.warning("当前状态不可操作");
              //           }
              //         },
              //       },
              //       style: {
              //         color: "#FF8C00",
              //       },
              //     },
              //     "向上报价"
              //   ),
              // ]);
            } else if (params.row.platformState == "1") {
              return h("div", [
                h(
                  "a",
                  {
                    on: {
                      click: () => {
                        if (
                          this.detailsGoods.status == 3 ||
                          this.detailsGoods.status == 4
                        ) {
                          this.editupwardQuotation(params.row);
                        } else {
                          this.$Message.warning("当前状态不可操作");
                        }
                      },
                    },
                    style: {
                      color: "#FF0000",
                    },
                  },
                  "修改"
                ),
              ]);
            } else if (params.row.platformState == "2") {
              return h("div", [
                h(
                  "a",
                  {
                    on: {
                      click: () => {
                        if (
                          this.detailsGoods.status == 3 ||
                          this.detailsGoods.status == 4 ||
                          this.detailsGoods.status == 5
                        ) {
                          this.companyData = params.row;
                          this.sourceEntrustment = true;
                          // this.EntrustedDriver(params.row);
                        } else {
                          this.$Message.warning("当前状态不可操作");
                        }
                      },
                    },
                    style: {
                      color: "#5892EB",
                    },
                  },
                  "委托"
                ),
              ]);
            } else if (params.row.platformState == "3") {
              return h("div", [
                h(
                  "a",
                  {
                    on: {
                      click: () => {
                        //查看运单详情
                      },
                    },
                    style: {
                      color: "#666666",
                    },
                  },
                  "已委托"
                ),
              ]);
            }
          },
        },
      ],
      data: [],
      // 向上报价
      upwardQuotationTitle: "向上报价",
      searchForm: {
        // 搜索框初始化对象
        pageNumber: 1, // 当前页数
        pageSize: 5, // 页面大小
        sort: "", // 默认排序字段
        order: "", // 默认排序方式
        orderGoodsId: "",
        grabOrdersType: "2",
      },
      pageNumber: 1, // 当前页数
      pageSize: 5, // 页面大小
      total: 0, // 表单数据总数
      OwnerInformationRow: "",
      payTypelist: [],
      driverPayType1: "3",
      goodIds: {},
    };
  },
  components: {
    DriverDetails,
    OwnerDetails,
    VehicleDetails,
  },
  created() {
    this.goodIds = JSON.parse(this.$route.query.key);
  },
  mounted() {
    // this.OwnerInformationRow = JSON.parse(this.$route.query.row);
    this.init();
    let arr = JSON.parse(window.localStorage.getItem("payment_method_type"));
    for (let i = 0; i < arr.length; i++) {
      let obj = {};
      obj.label = arr[i].description;
      obj.value = arr[i].value;
      this.payTypelist.push(obj);
    }
    this.getDate();
  },
  methods: {
    // 获取当前时间
    getDate() {
      let this_ = this;
      let yy = new Date().getFullYear();
      let yy2 = new Date().getFullYear() + 2;

      let mm = new Date().getMonth() + 1;
      let yue = mm > 10 ? mm : "0" + mm;
      let dd =
        new Date().getDate() < 10
          ? "0" + new Date().getDate()
          : new Date().getDate();

      // 　　let hh = new Date().getHours()<10 ? '0'+new Date().getMinutes() : new Date().getMinutes();
      // 　　let mf = new Date().getMinutes()<10 ? '0'+new Date().getMinutes() : new Date().getMinutes();
      // 　　let ss = new Date().getSeconds()<10 ? '0'+new Date().getSeconds() : new Date().getSeconds();
      this_.openDate =
        yy + "-" + yue + "-" + dd + " " + "00" + ":" + "00" + ":" + "00";
      this_.endDate =
        yy2 + "-" + yue + "-" + dd + " " + "00" + ":" + "00" + ":" + "00";

      this_.startReceivingTime =
        yy + "-" + yue + "-" + dd + " " + "00" + ":" + "00" + ":" + "00";
      this_.endReceivingTime =
        yy2 + "-" + yue + "-" + dd + " " + "00" + ":" + "00" + ":" + "00";
    },
    //开启时间
    changOpen(val) {
      this.startReceivingTime = val;
    },
    // 关闭时间
    changeEnd(val) {
      this.endReceivingTime = val;
    },
    // 开启ECT
    openEtc() {
      goodsInvoicingEtc({
        goodsId: this.goodIds.goodId,
      }).then((res) => {
        if (res.code == 200) {
          this.$Message.success("开启成功");
          this.getDataList();
        } else {
          this.$Message.error(res.message);
        }
      });
    },
    // 关闭|ETC
    closeEtc() {
      goodsInvoicingEtc({
        goodsId: this.goodIds.goodId,
      }).then((res) => {
        if (res.code == 200) {
          this.$Message.success("关闭成功");
          this.getDataList();
        } else {
          this.$Message.error(res.message);
        }
      });
    },
    // 合同编号
    DispatchOrder() {
      let pdf = "";
      pdf =
        this.$baseUrl +
        "/freight/file/view/" +
        this.detailsGoods.contractId +
        "?accessToken=" +
        this.accessToken +
        "&preview=true";
      window.open(pdf, "_blank");
    },
    init() {
      this.getDataList();
      // this.QuotationRecordList();
    },
    //发布范围
    ReleaseScopeClick() {
      this.ReleaseScopeModal = true;
    },
    // 删除驾驶员
    DeleteDriver(event, name) {
      const index = this.TagList.indexOf(name);
      this.TagList.splice(index);
    },
    getDataList() {
      this.subRemarks = "";
      getGoodsDetails({ goodsid: this.goodIds.goodId }).then((res) => {
        if (res.code == 200) {
          this.detailsGoods = res.result;
          this.beginAreaCodeShow =
            this.detailsGoods.beginProvinceName +
            this.detailsGoods.beginCityName +
            this.detailsGoods.beginAreaName;
          this.endAreaCodeShow =
            this.detailsGoods.endProvinceName +
            this.detailsGoods.endCityName +
            this.detailsGoods.endAreaName;
          //
          if (this.detailsGoods.cargoOwnerInfoVo.avatar) {
            if (this.detailsGoods.cargoOwnerInfoVo.avatar.indexOf(":") !== -1) {
              this.cargoAvatar = this.defaultAvatar;
            } else {
              this.cargoAvatar =
                this.$baseUrl + this.detailsGoods.cargoOwnerInfoVo.avatar;
            }
          } else {
            this.cargoAvatar = this.defaultAvatar;
          }

          if (this.detailsGoods.content != null) {
            if (this.detailsGoods.content.length >= 15) {
              let text1 = this.detailsGoods.content.substring(0, 10);
              this.subRemarks = `${text1}....`;
            } else {
              this.subRemarks = this.detailsGoods.content;
            }
          }
        } else {
          this.$Message.error(res.message);
        }
      });
    },
    driverCompanyTabs(val) {
      if (val == "driverName") {
        this.searchForm.grabOrdersType = "2";
      } else {
        this.searchForm.grabOrdersType = "1";
      }
      this.QuotationRecordList();
    },
    //抢单列表
    QuotationRecordList() {
      (this.searchForm.orderGoodsId = this.goodIds.goodId),
        platformQuotationRecord(this.searchForm).then((res) => {
          if (res.code == 200) {
            if (res.result.records.length > 0) {
              this.getQuotationRecordData = res.result.records;
              this.total = res.result.total;
              if (
                this.getQuotationRecordData.length == 0 &&
                this.searchForm.pageNumber > 1
              ) {
                this.searchForm.pageNumber -= 1;
                this.QuotationRecordList();
              }
            } else {
              this.getQuotationRecordData = [];
            }
          } else {
            this.$Message.error(res.message);
          }
        });
    },

    // 修改订单
    ModifyQuotation() {},
    // 承运重量值改变触发
    GoodWeightFocus(val) {
      if (val > 0) {
        this.freightUnitPriceStatus = true;
        this.freightTotalPriceStatus = true;
        this.upwardQuotationForm.freightUnitPrice = "";
        this.upwardQuotationForm.freightTotalPrice = "";
      } else {
        this.freightUnitPriceStatus = false;
        this.freightTotalPriceStatus = false;
      }
    },
    // 运费单价点击改变触发
    freightUnitFocus() {
      if (this.upwardQuotationForm.transGoodWeight > 0) {
        this.freightUnitPriceStatus = true;
        this.freightTotalPriceStatus = true;
      } else {
        this.freightUnitPriceStatus = false;
        this.freightTotalPriceStatus = false;
        this.$Message.warning("请输入承运重量");
      }
    },
    // 运费单价值改变触发
    UnitPriceChange() {
      this.upwardQuotationForm.freightTotalPrice =
        Math.floor(
          this.upwardQuotationForm.freightUnitPrice *
            this.upwardQuotationForm.transGoodWeight *
            100
        ) / 100;
    },
    // 运费总价点击改变触发
    freightTotFocus() {
      if (this.upwardQuotationForm.transGoodWeight > 0) {
        this.freightUnitPriceStatus = true;
        this.freightTotalPriceStatus = true;
      } else {
        this.freightUnitPriceStatus = false;
        this.freightTotalPriceStatus = false;
        this.$Message.warning("请输入承运重量");
      }
    },
    // 运费总价值改变触发
    TotalPriceChange() {
      this.upwardQuotationForm.freightUnitPrice =
        Math.floor(
          this.upwardQuotationForm.freightTotalPrice *
            this.upwardQuotationForm.transGoodWeight *
            100
        ) / 100;
    },
    // 向上报价
    upwardQuotationClick(row) {
      if (this.detailsGoods.pricingMethod == 1) {
        //定价
        if (this.detailsGoods.pricingType == 1) {
          //按单价
          this.upwardQuotationForm.freightUnitPrice =
            this.detailsGoods.freightUnitPrice;
          this.upwardQuotationForm.freightTotalPrice =
            Math.floor(
              this.detailsGoods.freightUnitPrice * row.transGoodWeight * 100
            ) / 100;
        } else {
          //按整单
          this.upwardQuotationForm.freightUnitPrice =
            Math.floor(
              (this.detailsGoods.estimateAmt / row.transGoodWeight) * 100
            ) / 100;
          this.upwardQuotationForm.freightTotalPrice =
            this.detailsGoods.estimateAmt;
        }
      } else {
        //竞价
        if (this.detailsGoods.pricingType == 1) {
          //按单价
          this.upwardQuotationForm.freightUnitPrice =
            this.detailsGoods.maximumFreight;

          this.upwardQuotationForm.freightTotalPrice =
            Math.floor(
              this.detailsGoods.maximumFreight * row.transGoodWeight * 100
            ) / 100;
        } else {
          //按整单

          this.upwardQuotationForm.freightUnitPrice =
            Math.floor(
              (this.detailsGoods.maximumFreight / row.transGoodWeight) * 100
            ) / 100;
          this.upwardQuotationForm.freightTotalPrice =
            this.detailsGoods.maximumFreight;
        }
      }

      this.upwardQuotationForm.transGoodWeight = row.transGoodWeight;
      this.upwardQuotationForm.piece = row.piece;
      this.upwardQuotationForm.volume = row.volume;
      this.upwardQuotationForm.quotationRecordId = row.quotationRecordId;
      this.upwardQuotationForm.goodsId = this.detailsGoods.goodId;
      this.upwardQuotationModal = true;
      this.upwardQuotationTitle = "向上报价";
    },
    // 修改 向上报价
    editupwardQuotation(row) {
      this.upwardQuotationForm.transGoodWeight = row.transGoodWeight;
      this.upwardQuotationForm.freightUnitPrice = row.platformUnitPrice;
      this.upwardQuotationForm.freightTotalPrice = row.platformTotalPrice;
      this.upwardQuotationForm.piece = row.piece;
      this.upwardQuotationForm.volume = row.volume;
      this.upwardQuotationForm.quotationRecordId = row.quotationRecordId;
      this.upwardQuotationForm.goodsId = this.detailsGoods.goodId;
      this.upwardQuotationModal = true;
      this.upwardQuotationTitle = "修改报价";
    },
    // 确定 向上报价
    upwardQuotationDetermine() {
      this.$refs.upwardQuotationForm.validate((valid) => {
        if (valid) {
          this.loadingbut = true;
          for (var key in this.upwardQuotationForm) {
            if (this.upwardQuotationForm[key] == null) {
              this.upwardQuotationForm[key] = "";
            }
          }
          addQuotationRecord(this.upwardQuotationForm).then((res) => {
            this.loadingbut = false;
            if (res.code == 200) {
              this.$Message.success("操作成功");
              this.upwardQuotationModal = false;
              this.init();
            } else {
              this.$Message.error(res.message);
            }
          });
        }
      });
    },

    // 平台委托驾驶员
    EntrustedDriver() {
      this.loadingbut = true;
      entrustDriver({
        quotationRecordId: this.companyData.quotationRecordId,
      }).then((res) => {
        this.loadingbut = false;
        if (res.code == 200) {
          this.$Message.success("委托成功");
          this.init();
          this.sourceEntrustment = false;
        } else {
          this.$Message.error(res.message);
        }
      });
    },
    // 货源审核审核通过
    SourceApproved() {
      this.sourceAuditClick();
    },
    // 货源审核审核通过确定
    sourceAuditClick() {
      this.$Modal.confirm({
        title: "确认审核",
        content:
          "请确认" +
          this.detailsGoods.goodSubType +
          "确认货源信息无误审核通过吗？",
        loading: true,
        onOk: () => {
          let data = {
            goodId: this.detailsGoods.goodId,
            status: 3, //1拒接2
            reason: "", //原因
          };
          toExamineGoods(data).then((res) => {
            this.$Modal.remove();
            this.loadingbut = false;
            if (res.code == 200) {
              this.$Message.success("审核通过");
              this.sourceAudit = false;
              this.$router.push({
                name: "appointGoods",
                query: {
                  key: this.$route.query.key,
                },
              });
            } else {
              this.$Message.error(res.message);
            }
          });
        },
      });
    },
    // 再来一单
    OneMoreOrder() {
      this.$router.push({
        name: "OneMoreOrder",
        query: {
          key: this.$route.query.key,
          modifys: this.$route.query.modifys,
        },
      });
    },
    //删除货源
    deleteOwner() {
      this.$Modal.confirm({
        title: "确认删除",
        content: "确认 " + this.detailsGoods.goodSubType + "删除货源 ",
        loading: true,
        onOk: () => {
          delGoods({ goodId: this.detailsGoods.goodId }).then((res) => {
            this.$Modal.remove();
            if (res.code == 200) {
              this.$Message.success("删除成功");
              this.$router.push({
                name: "appointGoods",
                query: { key: this.$route.query.key },
              });
            } else {
              this.$Message.error(res.message);
            }
          });
        },
      });
    },
    //货源审核不审核通过
    AuditFailed() {
      this.AuditFailedModal = true;
    },
    // 货源审核不通过确认弹框
    AuditRejectDetermine() {
      if (this.AuditFailedInput == "") {
        this.$Message.warning("请输入审核不通过原因");
        return false;
      }
      this.loadingbut = true;
      let data = {
        goodId: this.detailsGoods.goodId,
        status: 1, //1拒接2
        reason: this.AuditFailedInput, //原因
      };
      toExamineGoods(data).then((res) => {
        if (res.code == 200) {
          this.$Message.success("操作成功");
          this.AuditFailedModal = false;
          this.$router.push({
            name: "appointGoods",
            query: {
              key: this.$route.query.key,
            },
          });
        } else {
          this.$Message.error(res.message);
        }
        this.loadingbut = false;
      });
    },
    // 返回
    goBack() {
      if (this.$route.query.modifys == 1) {
        this.$router.push({
          name: "appointGoods",
          query: {
            key: this.$route.query.key,
          },
        });
      } else if (this.$route.query.modifys == 2) {
        this.$router.push({
          name: "examine-goods",
          query: {
            key: this.$route.query.key,
          },
        });
      }
    },

    //承运订单
    CarrierOrderB() {
      this.$router.push({
        name: "CarrierSource",
        query: {
          row: JSON.stringify(this.detailsGoods),
          key: this.$route.query.key,
        },
      });
    },
    // 修改货源
    OwnerModification() {
      this.$nextTick(() => {
        this.$router.push({
          name: "editModal",
          query: {
            key: this.$route.query.key,
            modifys: this.$route.query.modifys,
          },
        });
      });
    },
    //调度派单指定驾驶员
    dispatchingDriver() {
      this.$router.push({
        name: "goods-map",
        query: {
          key: this.$route.query.key,
          modifys: this.$route.query.modifys,
        },
      });
    },
    // /完结货源
    CloseSource() {
      this.$Modal.confirm({
        title: "确认完结",
        content: "确认完结该货源吗？",
        loading: true,
        onOk: () => {
          updateGoodsStatus({
            goodId: this.detailsGoods.goodId,
            status: 5,
          }).then((res) => {
            this.$Modal.remove();
            if (res.code == 200) {
              this.$Message.success("操作成功");
              this.init();
            } else {
              this.$Message.error(res.message);
            }
          });
        },
      });
    },
    //开启货源
    OpenSource() {
      this.$Modal.confirm({
        title: "确认开启",
        content: "确认开启该货源？",
        loading: true,
        onOk: () => {
          updateGoodsStatus({
            goodId: this.detailsGoods.goodId,
            status: 3,
          }).then((res) => {
            this.$Modal.remove();
            if (res.code == 200) {
              this.$Message.success("操作成功");
              this.init();
            } else {
              this.$Message.error(res.message);
            }
          });
        },
      });
    },
    //关闭货源
    closeSourceOfGoods() {
      this.$Modal.confirm({
        title: "确认关闭",
        content: "确认关闭该货源？",
        loading: true,
        onOk: () => {
          updateGoodsStatus({
            goodId: this.detailsGoods.goodId,
            status: 4,
          }).then((res) => {
            this.$Modal.remove();
            if (res.code == 200) {
              this.$Message.success("操作成功");
              this.init();
            } else {
              this.$Message.error(res.message);
            }
          });
        },
      });
    }, // 请选择报价状态
    companyChange(val) {
      if (val == undefined) {
        this.searchForm.stateScreen = "";
      } else {
        this.searchForm.stateScreen = val;
      }
      this.loading = true;
      platformQuotationRecord(this.searchForm).then((res) => {
        this.loading = false;
        if (res.code == 200) {
          if (res.result.records.length > 0) {
            this.getQuotationRecordData = res.result.records;
          } else {
            this.getQuotationRecordData = [];
          }
        } else {
          this.$Message.error(res.message);
        }
      });
    },
    // 单价排序
    UnitPriceorting() {
      //1将 2升
      this.UnitPriceIcon = !this.UnitPriceIcon;
      if (this.UnitPriceIcon) {
        this.searchForm.priceSort = "2";
      } else {
        this.searchForm.priceSort = "1";
      }
      this.loading = true;
      platformQuotationRecord(this.searchForm).then((res) => {
        this.loading = false;
        if (res.code == 200) {
          if (res.result.records.length > 0) {
            this.getQuotationRecordData = res.result.records;
          } else {
            this.getQuotationRecordData = [];
          }
        } else {
          this.$Message.error(res.message);
        }
      });
    },
    //货主详细信息
    LookCargoOwnerInfo() {
      this.OwnerDetailsId = this.detailsGoods.companyUserId;
      this.OwnerDetailsModalue = true;
    },
    //货主详细信息
    LookCargoOwnerInfo1(val) {
      this.OwnerDetailsId = val.companyUserId;
      this.OwnerDetailsModalue = true;
    },
    // 货主详细信息关闭
    OwnerDetaiEnd(val) {
      this.OwnerDetailsModalue = val;
      this.OwnerDetailsId = "";
    },
    // 查看车辆详细
    LookVehicleInfo(row) {
      this.VehicleDetailsModalue = true;
      this.VehicleDetailsId = row.vehicleId;
    },
    //车辆详细信息关闭
    VehicleDetailsEnd(val) {
      this.VehicleDetailsModalue = val;
      this.VehicleDetailsId = "";
    },
    // 驾驶员
    BidderdDiver(row) {
      this.BidderdUserId = row.driverUserId;
      this.driverModalue = true;
    },
    // 驾驶员详情关闭
    DriverDetaEnd(val) {
      this.driverModalue = val;
      this.BidderdUserId = "";
    },
    // 表单反页
    changePage(v) {
      this.searchForm.pageNumber = v;

      this.QuotationRecordList();
    },
    changePageSize(v) {
      this.searchForm.pageSize = v;
      this.QuotationRecordList();
    },
  },
};
</script>
<style lang="less">
.InputNuspanfont {
  position: absolute;
  top: 2px;
  right: -45px;
  width: 50px;
  height: 31px;
  padding: 7px 0 0 0;
  text-align: center;
  line-height: 60px;
  font-size: inherit;
  font-weight: 400;
  line-height: 1;
  color: #515a6e;
  text-align: center;
  border-radius: 4px;
}
.my-content {
  width: 100px;
}
.my-limitation {
  width: 170px;
}
.Line {
  border: 0;
  border-top: 1px solid #eee;
  border-top-width: 1px;
  border-top-style: solid;
  border-top-color: rgb(238, 238, 238);
  border-bottom: 1px solid #fff;
  border-bottom-width: 1px;
  border-bottom-style: solid;
  border-bottom-color: rgb(255, 255, 255);
  margin: 20px 0;
}
.Ownerdw {
  // height: 80px;
  display: flex;
  .Ownerpoit {
    margin-top: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 1px solid #eee;
    img {
      width: 100%;
      height: 100%;
      border-radius: 50%;
    }
  }
  .OwnerName {
    margin-left: 17px;
    padding: 33px 0;
    .OwnerName1 {
      margin-left: 10px;
      color: #999999;
    }
    .Owner-company {
      margin-top: 10px;
      cursor: pointer;
    }
  }
}
.ReasonRejection {
  color: #08c;
  margin-left: -600px;
  padding: 25px 0;
  margin-top: 20px;
}
.ReasonsFailureAudit {
  color: red;
}
.Ownertiem {
  padding: 25px 0;
  margin-top: 2px;
  .statee,
  .implemented,
  .end,
  .refuse,
  .AuditFailed,
  .quotation,
  .deeltes,
  .erreCss {
    width: 50px;
    margin-bottom: 10px;
    background-color: rgb(70, 136, 71);
    color: #fff;
    // line-height: 55px;
    padding: 2px 0;
    text-align: center;
    font-size: 12px;
    margin-left: 9px;
    border-radius: 3px;
    display: inline-block;
    margin-left: 25px;
  }
  .quotation {
    background-color: rgb(70, 136, 71);
  }
  .implemented {
    background-color: #2d8cf0;
  }
  .deeltes {
    background-color: #d3d3d3;
  }
  .AuditFailed {
    background-color: #dc143c;
    width: 70px;
    margin-left: 25px;
  }
  .erreCss {
    background-color: #dc143c;
  }
}
.CarrierSource {
  width: 70px;
  margin-bottom: 10px;
  background-color: #808080;
  color: #fff;
  // line-height: 55px;
  padding: 2px 0;
  text-align: center;
  font-size: 12px;
  margin-left: 25px;
  border-radius: 3px;
  display: inline-block;
}
.butTable {
  width: 100%;
  padding: 5px;
  // border: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  // background-color: #f8f8f9;
  .butTableoffer {
    font-size: 16px;
    font-weight: 700;
    margin-top: 5px;
    margin-left: -2px;
    font-size: 16px;
    margin-bottom: 6px;
    span {
      font-size: 14px;
      font-weight: 400;
    }
  }
}
.Cardokbtn {
  position: relative;
  bottom: -5px;
  left: 0;
}
.okbtn {
  z-index: 99999;
  width: 100%;
  margin-top: -15px;
  background-color: #f5f5f5;
  border: 1px solid #cdcdcd;
  height: 70px;
  line-height: 70px;
}

.butall {
  display: flex;
  justify-content: space-between;
}
.ListItemcss {
  height: 200px;
  overflow: auto;
}
.ListItemMetacss {
  margin-left: 40px;
}
.ListItemMetac1 {
  width: 350px;
  margin-left: 110px;
  color: #999999;
  font-size: 10px;
}
.el-descriptions__header {
  margin-bottom: 10px;
}
.NotFilled {
  font-size: 14px;
  color: #a9a9a9;
}
.LengthvehicleType {
  width: 250px;
}
.TagModal {
  float: left;
  margin: 5px;
}
.table table {
  width: 100% !important;
}
.listMomoney {
  margin-left: 15px;
  font-weight: 600;
}
.divercss {
  position: absolute;
  bottom: 166px;
  left: 120px;
}
.divercs4 {
  position: absolute;
  bottom: 75px;
  left: 120px;
}
.divercss1 {
  position: absolute;
  bottom: 212px;
  left: 120px;
}
.divercss5 {
  position: absolute;
  bottom: 119px;
  left: 120px;
}
.divercss2 {
  position: absolute;
  bottom: 122px;
  left: 120px;
}
.divercss3 {
  position: absolute;
  bottom: 76px;
  left: 120px;
}
.newcarrier {
  margin-top: 10px;
  margin-left: 20px;
  display: flex;
  .Ownerportrait {
    margin-top: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 1px solid #eee;
    img {
      width: 100%;
      height: 100%;
      border-radius: 50%;
    }
  }
  .carrierName {
    margin-left: 17px;
    padding: 25px 0;
    .carrierName1 {
      margin-left: 10px;
      color: #999999;
    }
    .Owner-company {
      margin-top: 10px;
      cursor: pointer;
    }
  }
}
.carrier {
  position: relative;
  top: -10px;
  left: 50px;
  font-size: 14px;
  font-weight: 600;
}
.Ownerdw-shipper {
  position: relative;
  top: 0px;
  left: 52px;
  font-size: 14px;
  font-weight: 600;
}
.time-css-box{
  border: 1px solid #eee;
  padding: 9px;
  border-radius: 5px;
  background-color: #ecf5ff;
  border-color: #d9ecff;
}
</style>
